package com.example.heimaplayer.util

import com.example.heimaplayer.R
import com.example.heimaplayer.base.BaseFragment
import com.example.heimaplayer.ui.fragment.HomeFragment
import com.example.heimaplayer.ui.fragment.MvFragment
import com.example.heimaplayer.ui.fragment.VBangFragment
import com.example.heimaplayer.ui.fragment.YueDanFragment


//管理fragment的util类
class FragmentUtil private constructor(){
    val homeFragment by lazy { HomeFragment() }
    val mvFragment by lazy { MvFragment() }
    val vbangFragment by lazy { VBangFragment() }
    val yueDanFragment by  lazy { YueDanFragment() }
    companion object{
        val fragmentUtil by lazy { FragmentUtil() }
    }

    fun getFragemnt(tabId:Int):BaseFragment?{
        when (tabId){
            R.id.tab_favorites ->return homeFragment
            R.id.tab_center ->return mvFragment
            R.id.tab_me ->return vbangFragment
        }
     return null
    }
}